home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / user / cup_closecup.rexx next >
OS/2 REXX Batch file  |  1999-11-29  |  4KB  |  168 lines

  1. /* Mode=Run */
  2. /* ***********************************************************************
  3.  
  4.    CLOSE CUP PROGRAM FOR FOOTBALL REXX SUITE
  5.   -------------------------------------------
  6.                    Copyright  Mark Naughton 1999
  7.  
  8.  
  9. Version    Date     History
  10. --------------------------------------------------------------------------
  11.  
  12.  1.0       210499   First release.
  13.            250899   Added error msg to file checks.
  14.            280899   Converted to use locale. Some error messages, before
  15.                     reading the locale, will still be in English. Renaming
  16.                     of history file to month name is also localed.
  17.  
  18. **************************************************************************
  19.  
  20. Procedure
  21. ---------
  22.  
  23. 1. Check files.
  24. 2. Setup new filename.
  25. 3. Rename files.
  26. 4. Output message.
  27.  
  28. ************************************************************************** */
  29. PARSE ARG league_file
  30.  
  31. version      = 1
  32. input_file   = '.cf'
  33. input2_file  = '.scf'
  34. input3_file  = '.cfrw'
  35. input4_file  = '.cfh'
  36. mnths        = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'
  37. league_stuff = "Data/"league_file
  38.  
  39.  
  40. if open(datafile,"Data/Football.locale",'r') then do
  41.    line = readln(datafile)
  42.    locdir = strip(line)
  43.    close(datafile)
  44. end
  45. else do
  46.    say
  47.    say "ERROR :    (Cup_CloseCup)"
  48.    say
  49.    say "Cannot read 'Data/Football.locale' for the locale settings."
  50.    exit
  51. end
  52.  
  53. locdir = locdir"User/Cup_CloseCup.data"
  54.  
  55. if open(datafile,"ENV:FootballRXPath",'r') then do
  56.    line = readln(datafile)
  57.    rxdir = strip(line)
  58.    close(datafile)
  59. end
  60. else
  61.    rxdir = "SYS:Rexxc/"
  62.  
  63. if exists(locdir) > 0 then do
  64.   address command rxdir'rx 'locdir
  65.   VarCount = getclip('VarCount')
  66.   do i = 1 to VarCount
  67.     interpret getclip('var.'i)
  68.   end
  69. end
  70. else do
  71.    say
  72.    say "ERROR :    (Cup_CloseCup)"
  73.    say
  74.    say "Cannot find '"locdir"' to read locale settings."
  75.    exit
  76. end
  77.  
  78. if exists(league_stuff||input_file) = 0 then do
  79.    say
  80.    say ccc_error
  81.    say
  82.    say ccc_one"'"league_file || input_file"'."
  83.    exit
  84. end
  85.  
  86. if exists(league_stuff||input2_file) = 0 then do
  87.    say
  88.    say ccc_error
  89.    say
  90.    say ccc_one"'"league_file || input2_file"'."
  91.    exit
  92. end
  93.  
  94. if exists(league_stuff||input3_file) = 0 then do
  95.    say
  96.    say ccc_error
  97.    say
  98.    say ccc_one"'"league_file || input3_file"'."
  99.    exit
  100. end
  101.  
  102. if exists(league_stuff||input4_file) = 0 then do
  103.    say
  104.    say ccc_error
  105.    say
  106.    say ccc_one"'"league_file || input4_file"'."
  107.    exit
  108. end
  109.  
  110. today = date()
  111. month = strip(word(today,2))
  112. do i=1 to 12
  113.    if month = word(mnths,i) then do
  114.       month = word(ccc_mnths,i)
  115.       leave
  116.    end
  117. end
  118. year  = substr(word(today,3),3,2)
  119.  
  120. nleague_file = league_file"_"month||year
  121.  
  122.  
  123. f1 = league_stuff||input_file" as Data/"nleague_file||input_file
  124. address command 'c:Rename >NIL: 'f1
  125.  
  126. f1 = league_stuff||input2_file" as Data/"nleague_file||input2_file
  127. address command 'c:Rename >NIL: 'f1
  128.  
  129. f1 = league_stuff||input3_file" as Data/"nleague_file||input3_file
  130. address command 'c:Rename >NIL: 'f1
  131.  
  132.  
  133.  
  134. say
  135. say center(ccc_two,78)
  136. say "-------------------------------------------------------------------------------"
  137. say
  138. say
  139. say ccc_three"'"league_file"'"ccc_four
  140. say
  141. say "                    '"nleague_file||input_file"'"
  142. say "                    '"nleague_file||input2_file"'"
  143. say "                    '"nleague_file||input3_file"'"
  144. say
  145. say
  146.  
  147. if exists(league_stuff||input4_file) > 0 then do
  148.    say ccc_txt1"'"league_file||input4_file"'"ccc_txt2
  149.    say
  150.    say ccc_txt3
  151.    say ccc_txt4
  152.    say
  153.    say
  154.    say
  155.    say ccc_txt6"'"nleague_file||input_file"'"ccc_txt7
  156.    say
  157.    say ccc_txt9
  158.    say
  159.    say ccc_txt0"'"league_file"'"ccc_txta
  160.    say
  161.    say
  162. end
  163.  
  164. say
  165. say "-------------------------------------------------------------------------------"
  166. say
  167.  
  168. exit